﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="JSC.Portal.Core" namespace="JSC.Portal.Entities">

  <class name="PortalUser" table="jsc_user" lazy="false">

    <!-- start Base on every entity -->
    <id name="Id" column="userid" unsaved-value="-1">
      <generator class="native">
        <param name="sequence">jsc_user_userid_seq</param>
      </generator>
    </id>
    <!-- end Base on every entity -->

    <property name="Username" column="username"/>
    <property name="Password" column="password"/>
    <property name="PasswordSalt" column="passwordsalt"/>
    <property name="Firstname" column="firstname"/>
    <property name="Lastname" column="lastname"/>
    <property name="EMail" column="EMail"/>
    <property name="IsActive" column="isactive"/>
    <property name="LastLogin" column="lastlogin" type="DateTime"/>
    <property name="LastIP" column="lastip"/>
    <many-to-one name="PortalSite" class="PortalSite" column="siteid" not-null="false" not-found="ignore"/>

    <bag name="Roles" table="jsc_userrole" cascade="none" lazy="true">
      <key column="userid" />
      <many-to-many class="Role" column="roleid" outer-join="true" />
    </bag>
  </class>
</hibernate-mapping>